package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.DTO.InsertComboConfigBO;
import com.ruoyi.common.core.domain.DTO.SelectComboConfigListBO;
import com.ruoyi.common.core.domain.DTO.UpdateComboConfigBO;
import com.ruoyi.framework.web.service.ComboConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/combo/config")
public class ComboConfigController {
    @Autowired
    private ComboConfigService comboConfigService;
    @PostMapping("/insert")
    public AjaxResult insertComboConfig(@RequestBody @Validated InsertComboConfigBO insertComboConfigBO) {
        comboConfigService.insertComboConfig(insertComboConfigBO);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult updateComboConfig(@RequestBody UpdateComboConfigBO updateComboConfigBO) {
        comboConfigService.updateComboConfig(updateComboConfigBO);
        return AjaxResult.success();
    }

    @PostMapping("/select")
    public AjaxResult selectComboConfigList(@RequestBody SelectComboConfigListBO selectComboConfigListBO) {
        return AjaxResult.success(comboConfigService.selectComboConfigList(selectComboConfigListBO));
    }

    @GetMapping("/get/info/{id}")
    public AjaxResult getInfo(@PathVariable Long id) {
        return AjaxResult.success(comboConfigService.selectComboConfigById(id));
    }
}
